import {
    doExec
} from '@/api/request'

const apiPrefix = window.apiPrefix;

export const api = {
    // 系统管理员
    manage: {
        // 登录
        login(opts) {
            return doExec(`${apiPrefix}login`, opts);
        }
    },
    // 车辆
    cars: {
        // 首页
        home: {
            locationlist(opts) {
                return doExec(`${apiPrefix}api/car/locationlist`, opts);
            },
            gpsdata(opts) {
                return doExec(`${apiPrefix}api/car/gpsdata`, opts);
            },
            gpsxy(opts) {
                return doExec(`${apiPrefix}api/car/gpsxy`, opts);
            },
            gpshisdata(opts) {
                return doExec(`${apiPrefix}api/car/gpshisdata`, opts);
            },
            deptlist(opts) {
                return doExec(`${apiPrefix}api/car/deptlist`, opts);
            },
            carlist(opts) {
                return doExec(`${apiPrefix}api/car/carlist`, opts);
            },
            allcarno(opts) {
                return doExec(`${apiPrefix}api/car/allcarno`, opts);
            },
            insertcar(opts) {
                return doExec(`${apiPrefix}api/car/insertcar`, opts);
            },
            updatecar(opts) {
                return doExec(`${apiPrefix}api/car/updatecar`, opts, 'JSON');
            },
            getcarbyid(opts) {
                return doExec(`${apiPrefix}api/car/getcarbyid`, opts);
            },
            cartype(opts) {
                return doExec(`${apiPrefix}api/car/cartype`, opts);
            },
            deletecar(opts) {
                return doExec(`${apiPrefix}api/car/deletecar`, opts);
            },
        },
    }
};